package com.yl.controller;

import com.yl.dto.CommentDTO;
import com.yl.entity.Comment;
import com.yl.service.CommentClientService;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author yangl
 */
@RequestMapping("/comment")
@RestController
@Api(value = "内容接口", tags = "内容接口")
@AllArgsConstructor
public class CommentController {

    private final CommentClientService commentClientService;

    @PostMapping("/save")
    public String save(@RequestBody CommentDTO commentDTO){
        commentClientService.saveEntity(commentDTO);
        return "success";
    }

    @GetMapping("/list")
    public List<Comment> list(){
        return commentClientService.commentList();
    }
}
